package com.lihua.project.system.user.controller;


import com.lihua.framework.web.controller.BaseController;
import com.lihua.framework.web.page.TableDataInfo;
import com.lihua.project.system.article.domain.Article;
import com.lihua.project.system.article.service.IArticleService;
import com.lihua.project.system.user.domain.User;
import com.lihua.project.system.user.service.IUserService;
import com.lihua.project.taskcenter.taskcenter.domain.Task;
import com.lihua.project.taskcenter.taskcenter.service.ITaskService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @author wuyuj
 * 个人主页
 */
@Controller
@RequestMapping("/system/user/home")
public class HomeController extends BaseController {
    private static final Logger log = LoggerFactory.getLogger(ProfileController.class);

    private String prefix = "system/user/home";


    @Autowired
    private IUserService userService;


    /**
     * 个人信息
     */
    @GetMapping("/{id}")
    public String userHomeById(ModelMap mmap,@PathVariable("id") Long id) {

        // 取身份信息
        User selfUser = getSysUser();
        mmap.addAttribute("selfUser",selfUser);

        User user = userService.selectUserById(id);
        mmap.put("user", user);
        return prefix + "/home";
    }
}
